package com.wxxymakers.cklabrecruit.entity.enum_;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonValue;
import io.github.biezhi.excel.plus.converter.Converter;
import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * @AUTHOR soft
 * @DATE 2018/11/18 14:49
 * @DESCRIBE 实验室分组
 */
@AllArgsConstructor
@JsonFormat(shape = JsonFormat.Shape.OBJECT)
public enum Group {

    WEB("网站组"), APP("app组"), UNITY3D("3D可视化组");

    @Getter
    private String name;

    @JsonValue
    public String v() {
        return name;
    }

    public static class GroupConverter implements Converter<Group> {

        @Override
        public String write(Group value) {
            return value.getName();
        }

        @Override
        public Group read(String value) {
            for (Group group : Group.values()) {
                if (group.name.equals(value)) {
                    return group;
                }
            }
            return Group.WEB;
        }
    }
}
